package com.kushe.beetl;

import org.beetl.core.Context;
import org.beetl.core.Function;

/**
 * Created by WhiteBlue on 15/5/3.
 */
public class PrintSizeFunction implements Function {
    @Override
    public Object call(Object[] objects, Context context) {
        if (objects.length != 1) {
            throw new RuntimeException("length of params must be 1 !");
        }
        if (objects[0] == null) {
            return null;
        }
        String msg = objects[0].toString();
        int mode = Integer.valueOf(msg);

        String back = null;

        switch (mode) {
            case 0:
                back = "XXL";
                break;
            case 1:
                back = "XL";
                break;
            case 2:
                back = "L";
                break;
            case 3:
                back = "M";
                break;
            case 4:
                back = "S";
                break;
        }

        return back;
    }
}
